package thinkingInJava.enumerated;
// page 592 枚举加注释例
//: enumerated/OzWitch.java
//The witches in the land of Oz.
import static thinkingInJava.YTool.YPrint.*;

public enum OzWitch {
	// Instances must be defined first, before methods:
	WEST("Miss Gulch, aka the Wicked Witch of the West"),
	NORTH("Glinda, the Good Witch of the North"),
	EAST("Wicked Witch of the East, wearer of the Ruby " +
			"Slippers, crushed by Dorothy's house"),
	SOUTH("Good by inference, but missing");
	private String description;
	// Constructor must be package or private access:
	// 此构造器即使声明为 public ,也只能在类内部使用
	private OzWitch(String description) {
		this.description = description;
	}
	public String getDescription() { return description; }
	public static void main(String[] args) {
		for(OzWitch witch : OzWitch.values())
			print(witch + ": " + witch.getDescription());
	}
} /* Output:
WEST: Miss Gulch, aka the Wicked Witch of the West
NORTH: Glinda, the Good Witch of the North
EAST: Wicked Witch of the East, wearer of the Ruby Slippers, crushed by Dorothy's house
SOUTH: Good by inference, but missing
 *///:~
